package com.example.homeworkmutualevaluation.Service;

import com.example.homeworkmutualevaluation.Dao.EvaluationDao;
import com.example.homeworkmutualevaluation.Entity.Evaluation;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EvaluationService {
    @Resource
    private EvaluationDao evaluationDao;
    public void submitEvaluation(int taskid, int score, String comment) {
        Evaluation evaluation = new Evaluation(taskid, score, comment);
        evaluationDao.save(evaluation);
    }

    public List<Evaluation> findAllBySubmitter(int homeworkid, String submitter) {
        return evaluationDao.findAllBySubmitter(homeworkid, submitter);
    }

    public List<Evaluation> findAllByEvaluator(int homeworkid, String evaluator) {
        return evaluationDao.findAllByEvaluator(homeworkid, evaluator);
    }

    public List<Evaluation> findAllByEvaluator(String evaluator) {
        return evaluationDao.findAllByEvaluator(evaluator);
    }
}
